//管理员端首页获取学院统计数据




package xiangmu.schoolpaper.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import xiangmu.schoolpaper.pojo.VO.*;
import xiangmu.schoolpaper.result.Result;
import xiangmu.schoolpaper.service.AdminHomeService;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/home")
@Tag(name = "首页接口")
public class AdminHomeController {

    @Autowired
    private AdminHomeService adminHomeService;

    /*
    //查询上传论文总数
    @GetMapping("/getPaperSum")
    @Operation(summary = "查询上传论文总数接口")
    public Result<Integer> getPaperSum() {
        log.info("查询上传论文总数");
        Integer total = adminHomeService.getPaperSum();
        return Result.success(total);
    }

    //查询上传模板总数
    @GetMapping("/getTemplateSum")
    @Operation(summary = "查询上传模板总数接口")
    public Result<Integer> getTemplateSum() {
        log.info("查询上传模板总数");
        Integer count = adminHomeService.getTemplateSum();
        return Result.success(count);
    }

    //查询合格人数总数
    @GetMapping("/getPassSum")
    @Operation(summary = "查询合格人数总数接口")
    public Result<Integer> getPassSum() {
        log.info("查询合格人数总数");
        Integer amount = adminHomeService.getPassSum();
        return Result.success(amount);
    }
    //查询活跃用户数总数
    @GetMapping("/getActiveUsersSum")
    @Operation(summary = "查询活跃用户数总数接口")
    public Result<Integer> getActiveUsersSum() {
        log.info("查询活跃用户数总数");
        Integer number = adminHomeService.getActiveUsersSum();
        return Result.success(number);
    }
    */

//查询获取首页概览数据：上传模板总数、上传论文总数、合格人数总数、活跃用户数总数
    @GetMapping("/get-home-overview")
    @Operation(summary = "1获取首页概览数据：上传模板总数、上传论文总数、合格人数总数、活跃用户数总数")
    public Result<HomeOverviewVO> getHomeOverview(){
        log.info("获取首页概览数据：上传模板总数、上传论文总数、合格人数总数、活跃用户数总数");
        HomeOverviewVO homeOverviewVO = adminHomeService.getHomeOverview();
        return Result.success(homeOverviewVO);
    }

//查询近七天上传论文总数
    @GetMapping("/weekly-uploads")
    @Operation(summary = "2查询近七天上传论文总数接口")
    public Result<List<HomeWeekVO>> getWeeklyPaperUploads() {
        log.info("查询近七天上传论文总数");
        List<HomeWeekVO> weeklyUploads = adminHomeService.getWeeklyPaperUploads();
        return Result.success(weeklyUploads);
    }

//以专业为组的每个学生的论文评分分布情况
    @GetMapping("/score-distribution")
    @Operation(summary = "3以专业为组的每个学生的论文评分分布情况接口")
    public Result<ScatterChartVo> getPaperScoreDistribution() {
        log.info("以专业为组的每个学生的论文评分分布情况");
        ScatterChartVo scatterChartVo = adminHomeService.getPaperScoreDistribution();
        return Result.success(scatterChartVo);
    }
//以专业为组的论文总分在各分布区间的学生数量
    @GetMapping("/score-student-sum")
    @Operation(summary = "4以专业为组的论文总分在各分布区间的学生数量接口")
    public Result<List<HomeScoreStudentSumVO>> getAdminHomeScoreStudentSum() {
        log.info("以专业为组的论文总分在各分布区间的学生数量");
        List<HomeScoreStudentSumVO> homeScoreStudentSumVOS = adminHomeService.getAdminHomeScoreStudentSum();
        return Result.success(homeScoreStudentSumVOS);
    }
}





